package com.cq.hd.member.mapper;

import com.cq.hd.member.api.dto.*;
import com.cq.hd.member.api.vo.*;
import com.cq.hd.member.po.TbBusinessAgentPo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 商家经纪人关联表 Mapper 接口
 * </p>
 *
 * @author mYunYu
 * @since 2023-11-21
 */
@Mapper
public interface TbBusinessAgentMapper extends BaseMapper<TbBusinessAgentPo> {

    List<BusinessAgentVo> listByBusinessIds(@Param("businessIds") List<Long> businessIds);

    List<MyAgentPageVo> lisMyAgentByDto(MyAgentPageDto myAgentPageDto);

    List<MyBusinessPageVo> lisMyBusinessByDto(MyBusinessPageDto myBusinessPageDto);

    int updateGroupId(BusinessGroupBatchChangeGroupDto businessGroupBatchChangeGroupDto);

    int updateCommissionRate(CommissionRateUpdateDto commissionRateUpdateDto);

    List<BusinessAgentCommissionPageVo> lisAgentCommissionByDto(BusinessAgentCommissionPageDto businessAgentCommissionPageDto);

    int updateBind(TbBusinessAgentPo businessAgentPo);

    int updateUnBind(TbBusinessAgentPo tbBusinessAgentPo);

    List<BusinessGroupAgentPageVo> lisBusinessGroupAgentByDto(BusinessGroupAgentPageDto businessGroupAgentPageDto);

    BusinessAgentVo getBusinessAgentById(@Param("businessId") Long businessId, @Param("userId") Long userId);

    List<BusinessSelectAgentGroupMapperVo> listBusinessSelectAgent(@Param("businessId") Long businessId);

    List<BusinessAgentVo> listByDto(BusinessAgentDto businessAgentDto);

    Boolean updateBusinessAgentOrder(UpdateBusinessAgentOrderDto updateBusinessAgentOrderDto);

    Boolean updateSubAgentOrder(UpdateSubAgentOrderDto updateSubAgentOrderDto);

    Integer updateStateByUserId(@Param("userId") Long userId, @Param("state") Integer state);

    TbBusinessAgentPo getBusinessAgentRecord(@Param("businessId") Long businessId, @Param("agentId") Long agentId, @Param("userId") Long userId);

    // 我的上级经纪人
    MyAgentVo myParentAgent(@Param("userId") Long userId);

    // 我的策划人id
    List<Long> myBusinessIds(@Param("userId") Long userId);
    List<AgentCommissionRateVo> listAgentCommissionRateByBusinessIds(@Param("userId") Long userId, @Param("businessIds") List<Long> businessIds);
}
